/*
 * Scaffold Application Framework
 *
 * Copyright (c) 2010 Sii Sp. z o.o. All rights reserved.
 */

package com.rstrulak.constant;

/**
 * Carries information about list data presentation requirements. May include
 * paging or sorting informations or both. Paging informations contained in
 * objects of this class are also used for carrying informations about list data
 * number of results and number of pages.
 * 
 * @author Jakub Ciechan
 * @version 1.0
 */
public class PresentationInfo {
    /** Requested or received paging. */
    private PageInfo pageInfo;

    /** Requested sorting. */
    private SortInfo sortInfo;

    /**
     * Default constructor.
     */
    public PresentationInfo() {
    }

    /**
     * Creates PresentationInfo with pageInfo variable set.
     * 
     * @param pageInfo .
     */
    public PresentationInfo(PageInfo pageInfo) {
        this.pageInfo = pageInfo;
    }

    /**
     * Creates PresentationInfo with sortInfo variable set.
     * 
     * @param sortInfo .
     */
    public PresentationInfo(SortInfo sortInfo) {
        this.sortInfo = sortInfo;
    }

    /**
     * Creates PresentationInfo with pageINfo and sortInfo variable set.
     * 
     * @param pageInfo .
     * @param sortInfo .
     */
    public PresentationInfo(PageInfo pageInfo, SortInfo sortInfo) {
        this.pageInfo = pageInfo;
        this.sortInfo = sortInfo;
    }

    /**
     * Determines whether this object includes paging informations.
     * 
     * @return true if it does
     */
    public boolean isPagingIncluded() {
        return pageInfo != null;
    }

    /**
     * Determines whether this object includes sorting informations.
     * 
     * @return true if it does
     */
    public boolean isSortingIncluded() {
        return sortInfo != null;
    }

    public PageInfo getPageInfo() {
        return pageInfo;
    }

    public SortInfo getSortInfo() {
        return sortInfo;
    }

    public void setPageInfo(PageInfo pageInfo) {
        this.pageInfo = pageInfo;
    }

    public void setSortInfo(SortInfo sortInfo) {
        this.sortInfo = sortInfo;
    }
}
